<template>
  <van-dialog use-slot title="驳回原因弹窗" :show-confirm-button="false" :show-cancel-button="false" :show="_examineDialog"
    @close="onClose()">
    <view style="padding-bottom: 32rpx;position: relative">
      <van-icon name="clear" style="position: absolute; right: 20rpx; top: -80rpx;color: rgba(74, 74, 74, 0.73)"
        @click="onClose()" />
      <view style="display: flex; padding: 42rpx">
        <span class="examineLabel">驳回原因</span>
        <u-textarea v-model="auditExamineText" placeholder="请输入驳回原因"></u-textarea>
      </view>
      <view style="width: 100%;text-align: center;justify-content: center">
        <!-- <van-button></van-button> -->
        <view class="customConfirm" @click="auditExamine">确定</view>
      </view>
    </view>
  </van-dialog>
</template>

<script>
export default {
  props: {
    examineDialog: {
      type: Boolean,
      // default: false
      required: true

    },
    // operateAuditId: {
    //   type: [String, Number],
    //   required: true
    // }
  },
  data() {
    return {
      auditExamineText: "",
      // _examineDialog: false
    }
  },
  watch: {
    examineDialog: {
      handler: function (val) {
        console.log(val, 'examineDialog监听')
      },
      immediate: true
    }
  },
  computed: {
    _examineDialog: {
      get() {
        console.log(this.examineDialog, 'examineDialog1111')
        return this.examineDialog
      },
      set(val) {
        console.log(this._examineDialog, val, '_examineDialog')
        uni.$emit('examinDialog', val)
      }
    }
  },
  methods: {
    onClose() {
      console.log('点击关闭')
      this._examineDialog = false
    },
    // 审核驳回确定
    auditExamine() {
      console.log(this.auditExamineText, '驳回理由-子组件')
      if (this.auditExamineText) {
        uni.$emit('auditExamine', this.auditExamineText)
        // console.log(this.auditExamineText, '调用接口')
        this._examineDialog = false
      } else {
        this.$modal.msg('请输入驳回理由！')
      }
    },
  }

}
</script>

<style lang="scss">
.examineLabel {
  margin-right: 24rpx;
  color: #989898;
  font-weight: bold;
  font-size: 24rpx;
  line-height: 34rpx;
}
.customConfirm {
  display: inline-block;
  font-family: PingFang SC, PingFang SC;
  font-weight: bold;
  font-size: 24rpx;
  color: #ffffff;
  line-height: 48rpx;
  background: #2769f7;
  border-radius: 10rpx 10rpx 10rpx 10rpx;
  padding: 6rpx 30rpx;
}
</style>